from numpy import exp

def sigma(z,w1,w2):
    res = z
    for m in range(-500,501):
        for n in range(-500,501):
            if m == 0 and n == 0:
                continue
            w = m*w1 + n*w2
            res *= ((1-z/w)*exp(z/w + 0.5*(z/w)**2))
    return res
